package com.dreamer.service.pyramid;

import com.dreamer.domain.pyramid.CashVo;
import com.dreamer.domain.pyramid.CashWithdrawal;
import com.dreamer.repository.pyramid.CashWithdrawalDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ps.mx.otter.utils.SearchParameter;

import java.util.List;

@Service
public class CashWithdrawalHandler {

    @Autowired
    private CashWithdrawalDAO cashWithdrawalDAO;

    @Transactional
    public CashWithdrawal saveOrupdate(CashWithdrawal cashWithdrawal){
        CashWithdrawal instance = cashWithdrawalDAO.merge(cashWithdrawal);
        return instance;
    }

    @Transactional
    public void removeCashWithdrawal(CashWithdrawal cashWithdrawal) {
        cashWithdrawalDAO.delete(cashWithdrawal);
    }

    public CashWithdrawal findById(Integer integer) {
        return  cashWithdrawalDAO.findById(integer);
    }

    public List<CashWithdrawal> searchAllByPage(SearchParameter<CashWithdrawal> parameter) {
        return cashWithdrawalDAO.searchAllByPage(parameter);
    }

    public List<CashWithdrawal> findAll(){
        return cashWithdrawalDAO.findAll();
    }

    public List<CashVo> findCashVoAll(SearchParameter<CashVo> parameter){
        return cashWithdrawalDAO.findCashVoAll(parameter);
    }

    public CashVo findByIdVo(Integer integer) {
        return  cashWithdrawalDAO.findByIdVo(integer);
    }

}
